home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
FPCDOCS.LZH
/
VIDEO2.SEQ
< prev
Wrap
Text File
|
1988-08-05
|
5KB
|
116 lines
\ VIDEO2.SEQ Actual video output routine By Tom Zimmer
FILES DEFINITIONS
VARIABLE VIDEO2.SEQ
FORTH DEFINITIONS
VARIABLE NOSETCUR
DECIMAL
CODE VIDEO-TYPE ( string length -- )
MOV AX, #LINE
MOV DX, #OUT
POP BX
cmp bx, # 0 \ if length = 0 then exit
<= if
pop bx
next
then
PUSH BX \ Put length and #OUT on stack
PUSH DX
cmp ax, # 24 \ Clip #LINE to 25 lines
u>= if
mov ax, # 24
then
mov #line ax
PUSH AX
ADD DX, BX \ Set length + X position to DL
cmp dx, # 80 \ Clip #OUT to 80 characters
u>= if
mov dx, # 80
then
mov #out dx
cmp nosetcur # 0 \ Do we want to spend time setting
0= if \ the cursor position?
MOV DH, AL \ Move Y to DH
XOR BX, BX \ Clear BX
MOV AH, # 2
INT 16 \ Move cursor to end of typed string
then
MOV AX, # 160 \ calculate actual cursor position
POP BX MUL BX MOV DI, AX
POP AX SHL AX, # 1 ADD DI, AX
POP CX POP BX
XCHG SI, BX \ SI is the source
PUSH BX \ Save SI for later restoral
PUSH ES \ save ES
MOV BX, # 1 \ Bit mask for retrace
MOV AX, VMODE-VAR
CMP AX, # 7 \ If video mode <> 7 (mono)
0<> IF MOV AX, BLANKING
OR AX, AX
0<> IF MOV DX, # 986 \ CGA status port
BEGIN IN AL, DX \ Wait for retrace
TEST AL, BX
0<> UNTIL
MOV DL, # 216 \ Address control reg
MOV AL, # 37 \ Disable the CRT
OUT DX, AL
THEN
THEN
MOV AH, ATTRIB \ display attributes
MOV ES, VIDEO-SEG \ destination segment
cmp cx, # 80
>= if \ Clip line to 80 characters
mov cx, # 80
then
mov dx, # 80
sub dx, cx
xchg dx, cx
shl cx, # 1
add cx, # here 10 + \ Add base addr of array
MOV DS, TYPESEG \ source segment
jmp cx \ JUMP to the right instruction
\ we are blowing out the loop here for speed, it only cost 160 bytes.
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW
POP ES \ restore ES
POP SI \ Restore IP
MOV BX, CS MOV DS, BX \ restore DS
MOV AX, VMODE-VAR
CMP AX, # 7
0<> IF MOV AX, BLANKING
OR AX, AX
0<> IF MOV DX, # 984 \ CGA mode control reg
MOV AL, # $2D \ Enable byte for mode 3
OUT DX, AL
THEN
THEN
NEXT END-CODE
DECIMAL